<template>
	<view>
		<view class="" v-if="recordList.length > 0">
		<!-- 维修记录 -->
		<uni-card v-for="(item,index) in recordList" :key="index">
			<view class="record" @click="navRouter(`../gird-service/gird-service?repairId=${item.repairId}`)">
				<view class="record-address">
					{{item.elevatorName}}
				</view>
				<view class="record-state">
					[{{item.elevatorFault && item.elevatorFault.faultType}}]
				</view>
				<view class="record-time">
					确认时间:
					<text>{{item.confirmDate || "暂无"}}</text>
				</view>
			</view>
		</uni-card>
		</view>
		<view class="" v-else>
			<nullPage></nullPage>
		</view>
	</view>
</template>

<script>
	import polling from "@/serve/api/polling.js";
	import nullPage from '@/common/null.vue'
	export default {
		components:{
			nullPage
		},
		data() {
			return {
				recordList: [],

				pageNum: 1,
				getListFlag: true,
			}
		},
		onLoad(e) {
			this.elevatorId = e.elevatorId;
			this.getleavtList()
		},
		methods: {
			async getleavtList() {
				const res = await polling.selectRepairListByElevator({
					elevatorId: this.elevatorId,
					pageNum: this.pageNum,
					pageSize: 10,
				});
				if (res.data.data.list.length < 10) {
					this.getListFlag = false;
				}
				this.recordList.push(...res.data.data.list)
			},

		},
		onReachBottom(e) {
			if (this.getListFlag) {
				this.pageNum = this.pageNum + 1;
				this.getleavtList();
			}
		}
	}
</script>

<style scoped>
	* {
		margin: 0;
		padding: 0;
	}

	page {
		background: #EFF2F5;
	}

	view {
		font-size: 28rpx;
		line-height: 1.8;

	}

	.uni-card {
		width: 670rpx;
		/* height: 280rpx; */
		background: #FFFFFF;
		box-shadow: 0rpx 10rpx 10rpx 0rpx rgba(52, 54, 61, 0.05);
		border-radius: 16rpx;
		margin: 0 auto;
		margin-top: 20rpx;
		border: none;
		line-height: 280rpx;
		text-align: left;
	}

	.record {
		font-family: PingFang SC;
		font-weight: 400;
		/* margin: 40rpx 0; */
	}

	.record-address {
		font-size: 30rpx;
		color: #34363D;
		margin-bottom: 30rpx;
	}

	.record-state {
		font-size: 30rpx;
		color: #017EFE;
	}

	.record-time {
		font-size: 24rpx;
		color: #989BA6;
	}

	.record-time text {
		margin-left: 15rpx;
		color: #34363D;
		word-spacing: 15rpx;
		letter-spacing: 1rpx;
	}
</style>
